<?php
class LuongsController extends AppController
{
    var $name = 'Luongs';

    function index()
    {

    }

    function view()
    {
        $this->set('title_for_layout', 'Lương nhân viên');
        if ($this->Session->read('quyen') != 'nhanvien') {
            $sql = 'select a.MANV, count(a.MACLV) as SOCA, (count(a.MACLV)*b.LUONG) as TIENLUONG
                from chamcong a, calamviec b
                group by a.MANV';
            $result = $this->Luong->query($sql);
            $this->set('kqs', $result);
            $this->set('LUONG');
        } else {
            $this->redirect(array('controller' => '', 'action' => 'index'));
        }
    }
}

?>